package zouran.util;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.net.URISyntaxException;

/**
 * Author：zouran
 * Date：2023/4/1  10:24
 * Description:定时任务
 */
@Component
public class ScheduleTask {
    private final EarthquakeDataUtil earthquakeDataUtil;

    public ScheduleTask(EarthquakeDataUtil earthquakeDataUtil) {
        this.earthquakeDataUtil = earthquakeDataUtil;
    }

    @Scheduled(cron = "0 0 2 * * ?")
    public void task() throws URISyntaxException, IOException {
        earthquakeDataUtil.get_data();
    }
}
